package com.cskaoyan.service.user;

import com.cskaoyan.bean.po.ohter.MarketGoodsExample;
import com.cskaoyan.bean.po.ohter.MarketGoodsProductExample;
import com.cskaoyan.bean.po.wxorder.MarketOrderExample;
import com.cskaoyan.bean.po.ohter.MarketUserExample;
import com.cskaoyan.bean.vo.user.DashBoardVo;
import com.cskaoyan.mapper.MarketGoodsMapper;
import com.cskaoyan.mapper.MarketGoodsProductMapper;
import com.cskaoyan.mapper.wxorder.MarketOrderMapper;
import com.cskaoyan.mapper.MarketUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Zhang Tao
 * @version 1.0.0
 * @description
 * @date since 2022-07-18 15:54
 */
@Service
public class DashBoardServiceImpl implements DashBoardService {
    @Autowired
    MarketGoodsMapper marketGoodsMapper;
    @Autowired
    MarketUserMapper marketUserMapper;
    @Autowired
    MarketGoodsProductMapper marketGoodsProductMapper;
    @Autowired
    MarketOrderMapper marketOrderMapper;

    @Override
    public DashBoardVo queryAllTotal() {
        DashBoardVo dashBoardVo = new DashBoardVo();
        long goodsTotal = marketGoodsMapper.countByExample(new MarketGoodsExample());

        long userTotal = marketUserMapper.countByExample(new MarketUserExample());

        long productTotal = marketGoodsProductMapper.countByExample(new MarketGoodsProductExample());

        long orderTotal = marketOrderMapper.countByExample(new MarketOrderExample());
        dashBoardVo.setGoodsTotal(goodsTotal);
        dashBoardVo.setUserTotal(userTotal);
        dashBoardVo.setProductTotal(productTotal);
        dashBoardVo.setOrderTotal(orderTotal);
        return dashBoardVo;

    }
}
